package model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.xml.bind.annotation.XmlTransient;

import com.sun.xml.bind.CycleRecoverable;

@Entity
public class Disciplina implements CycleRecoverable{
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id_disciplina")
	private Long id;
	
	private String nome;
	
	@ManyToOne
	@JoinColumn(name = "id_professor")
	@XmlTransient
	private Professor professor;
	
/*	@OneToMany(targetEntity = Aluno.class, cascade = CascadeType.ALL)
	@JoinTable(
			   name = "tb_aluno_disciplina",
			   joinColumns={
					   @JoinColumn(name = "id_disciplina",referencedColumnName = "id_disciplina")						   
			   	   			
			   },
			   inverseJoinColumns={
					   @JoinColumn(name = "id_aluno",referencedColumnName = "id_aluno")
			   }		   
	)
	private List<Aluno> alunos;*/
	
/*	@OneToMany(mappedBy = "disciplinas",targetEntity = Aula.class, cascade = CascadeType.ALL)
	private List<Aula> aulas;*/

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Professor getProfessor() {
		return professor;
	}

	public void setProfessor(Professor professor) {
		this.professor = professor;
	}

	@Override
	public Object onCycleDetected(Context arg0) {
		Professor p =  new Professor();
		return p;
	}





}
